Create charts for an economic comparison

This package also comes with utilities that allow you to create charts from the economy comparison operation. In this notebook, we’ll walk through them.

# First, set up the simulation

from policyengine import Simulation
from policyengine.outputs.macro.comparison.charts import *

sim = Simulation(
    country="uk",
    scope="macro",
    reform={
        "gov.hmrc.income_tax.allowances.personal_allowance.amount": 10_000,
    },
    title="Lowering the personal allowance to £10,000" # Required for charts
)

from policyengine.utils.charts import add_fonts

add_fonts() # Load the right font (Roboto Serif) in this notebook
/opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm

Budget

The budget chart shows high-level budget changes under the reform.

create_budget_comparison_chart(sim)

There is also the budget by program chart, which splits out the budgetary impact by program.

create_budget_program_comparison_chart(sim)

Decile

The decile chart shows the impact of the reform on each decile of the income distribution. You can specify whether this is over income deciles, or wealth deciles, in the UK.

create_decile_chart(sim, decile_variable="income", relative=True)

Winners and losers

The winners and losers chart shows in each decile (and overall) the share of people who come out ahead or behind under the reform. Again, you can specify whether the deciles are income or wealth in the UK.

create_winners_losers_chart(sim, decile_variable="income")

Inequality

The inequality chart shows the impact of the reform on various inequality measures: the Gini coefficient, the share of income held by the top 10% of households (by income) and the top 1% share.

create_inequality_chart(sim, relative=True)